package com.htthorizon.model.service;

import com.htthorizon.model.domain.SceneTopic;
import com.htthorizon.model.mapper.SceneTopicMapper;
import com.htthorizon.model.request.SceneTopicAddReq;
import com.htthorizon.model.request.SceneTopicSearchReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Brilliant
 */
@Service
public class SceneTopicServiceImpl implements ISceneTopicService{

    @Autowired
    private SceneTopicMapper sceneTopicMapper;
    @Override
    public List<SceneTopic> list(SceneTopicSearchReq search) {
        return  sceneTopicMapper.select(search);
    }

    @Override
    public boolean save(SceneTopicAddReq sceneTopicAddReq) {
        return sceneTopicMapper.insert(sceneTopicAddReq) > 0;
    }

    @Override
    public boolean edit(SceneTopicAddReq sceneTopicAddReq) {
        return sceneTopicMapper.updateByPrimaryKeySelective(sceneTopicAddReq) > 0;
    }

    @Override
    public boolean del(Long id) {
        return sceneTopicMapper.deleteByPrimaryKey(id) > 0;
    }
}
